<?php $data = array(
			'title' => '论文系统-首页',
			'css' => array('css/global.css','css/login.css'),
			'js' => array('bootstrap/docs/assets/js/bootstrap-typeahead.js','js/global.js','js/home.js'),
			'menu' => '02',
			'sub_menus' => array('paper/paper' => '论文管理', 'paper/upload' => '论文上传')
		);
		$this->load->view('templates/header',$data);

$school_arr = array();
foreach($schools->result() as $arr) {
	array_push($school_arr,'"'.$arr->name.'"');
}
$school_names = '['.join(',', $school_arr).']';

$profession_arr = array();
foreach($professions->result() as $arr) {
	array_push($profession_arr,'"'.$arr->name.'"');
}
$profession_names = '['.join(',', $profession_arr).']';

?>
<?php $this->load->view('templates/sub_menu',$data);?>


<div class="main clearfix">
	<div class="real-wrap clearfix">
		<?php $this->load->view('templates/paper_template');?>
		<div class="maincontent om">	
			<div id="signup_form">
				<p class="heading">论文上传</p>
				<div class="alert" <?php if(!$error) echo 'style="display:none;"'; ?>>
				    <button type="button" class="close" data-dismiss="alert">×</button>
				    <p class="red"><?=$error?></p>
				</div>
				<div class="alert" <?php if(!validation_errors()) echo 'style="display:none;"'; ?>>
			    	<button type="button" class="close" data-dismiss="alert">×</button>
			    	<?php echo validation_errors('<p class="error">','</p>'); ?>
			    </div>
				<?php echo form_open_multipart('paper/upload/upload_file'); ?>
				<!-- <p>
					<label>文件名: </label>
					<?php echo form_input('file_name',set_value('file_name')); ?>
				</p>-->
		
				<p>
					<label>指导老师: </label>
					<?php echo form_input('teacher',set_value('teacher')); ?>
				</p>
		
				<p>
					<label>字数: </label>
					<?php echo form_input('words',set_value('words')); ?>
				</p>
				
				<p>
					<label>学校: </label>
					<!--<select name="school">
						<?php foreach($schools->result() as $arr): ?>
						<option value="<?=$arr->id?>" <?php echo set_select('school', $arr->id); ?> ><?=$arr->name?></option>
						<?php endforeach; ?>
					</select>-->
					<input type="text" name="school" class="span2" data-provide="typeahead" data-source='<?php echo $school_names; ?>' data-items="4">
				</p>
				
				<p>
					<label>专业: </label>
					<!--<select name="profession">
						<?php foreach($professions->result() as $arr): ?>
						<option value="<?=$arr->id?>" <?php echo set_select('profession', $arr->id); ?>><?=$arr->name?></option>
						<?php endforeach; ?>
					</select>-->
					<input type="text" name="profession" class="span2" data-provide="typeahead" data-source='<?php echo $profession_names; ?>' data-items="4">
				</p>
				
				<p>
					<label>层次: </label>
					<select name="level">
						<?php foreach($levels->result() as $arr): ?>
						<option value="<?=$arr->id?>" <?php echo set_select('level', $arr->id); ?>><?=$arr->name?></option>
						<?php endforeach; ?>
					</select>
				</p>
		
				<p>
					<label>文件: </label>
					<input type="text" id=file_display name="upload_file" style="display:none;"/>
					<input type="file" id=fileInput name="userfile" onchange= "document.getElementById('file_display').value=this.value.substr(this.value.lastIndexOf('\\')+1,this.value.length);"/> 
				</p>
				
				<p>
					<?php echo form_submit('submit','提交', 'class="btn" onclick="valid_submit(this);"'); ?>
				</p>
				<?php echo form_close(); ?>
			</div>
		</div>


<?php $this->load->view('templates/footer');?>

